package com.easy.reconciliation.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

@Aspect
@Configuration
public class AopConfig {

    private static final Logger logger = LoggerFactory.getLogger(AopConfig.class);


    // 包下所有方法
    @Pointcut("execution(* com.easy.reconciliation.controller..*.*(..))")
    public void logs() {
    }

    @Before("logs()")
    public void logBefore(JoinPoint joinPoint) {
        //	LOG.info(" logBefore ...>!.>!>>!.>!.!>.!");

        // logger.info("logBefore 拦截到了" + joinPoint.getSignature().getName() + "方法...");
    }

    //
    @Around("logs()")
    public Object logAround(ProceedingJoinPoint thisJoinPoint) throws Throwable {
        Object obj = null;
        //	LOG.info("切面around before执行了");

        Object[] args = thisJoinPoint.getArgs();
        // logger.info("拦截到了" + thisJoinPoint.getSignature().getName() + "方法...");
        return thisJoinPoint.proceed(args);

    }

    @After("logs()")
    public void logAfter(JoinPoint joinPoint) {

        //  logger.info("logAfter 拦截到了" + joinPoint.getSignature().getName() + "方法...");
    }

}
